package net.zjitc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller

public class UserController {
    //不常用
    @RequestMapping( "/quick5")
    public String save5(HttpServletRequest request){
        request.setAttribute("msg","hello mvc");
        return "success";
    }

    @RequestMapping( "/quick4")
    public String save4(Model model){
        model.addAttribute("msg","hello mvc");
        return "success";
    }
    @RequestMapping( "/quick3")
    public ModelAndView save3(ModelAndView mv){
        mv.addObject("msg","hello mvclalala");
        mv.setViewName("success");
        return mv;
    }
    @RequestMapping( "/quick2")
    public ModelAndView save2(){
        ModelAndView mv = new ModelAndView();
        mv.addObject("msg","hello mvc");
        mv.setViewName("success");
        return mv;
    }
    @RequestMapping( "/quick")
    public String save(){
        System.out.println("controller running");
        return "success";
    }



    //回写
    @RequestMapping( "/quick6")
    public void save6(HttpServletResponse response)throws IOException{
        response.getWriter().print("hello mvc")
    }
    @RequestMapping( "/quick7")
    @ResponseBody
    public String save7()throws IOException{
        return "hello mvc"
    }

}
